package com.dongdongshop.controller;

import com.dongdongshop.data.Result;
import com.dongdongshop.pojo.TbContent;
import com.dongdongshop.service.TbContentService;
import com.dongdongshop.service.TbGoodsService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@Controller
@RequestMapping("goods")
public class GoodsContorller {

    private Logger logger = LoggerFactory.getLogger(GoodsContorller.class);
    @DubboReference(check = false)
    private TbContentService contentService;

    @RequestMapping("contentList")
    @ResponseBody
    public Result contentList(Long id){
        try {
            List<TbContent> contentList =  contentService.selectContentByCateId(id);
            return Result.OK().setData(contentList);
        }catch (Exception e){
            logger.info("查询广告方法异常 {}",e.toString());
            return Result.ERROR();
        }
    }
}
